package com.wenson.behavior.command;

import com.wenson.behavior.strategy.KeyBoard;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @ClassName: TVClient
 * @Author: luowangcheng
 * @Date: 2024/6/16 13:11
 * @Description:
 */
public class TVClient {
    public static void main(String[] args) {
        Keyboard keyboard = new Keyboard();
        TV tv = new TV();
        Command tvOnCommand = new TVOnCommand(tv);
        Command tvOffCommand = new TVOffCommand(tv);
        Command tvChannelUpCommand = new TVChannelUpCommand(tv);

        keyboard.bindKeyCommand(
                Keyboard.KeyCode.F1,
                Arrays.asList(tvOnCommand)
        );
        keyboard.bindKeyCommand(
                Keyboard.KeyCode.LEFT,
                Arrays.asList(tvChannelUpCommand)
        );
        keyboard.bindKeyCommand(
                Keyboard.KeyCode.ESC,
                Arrays.asList(tvOffCommand)
        );

        keyboard.onKeyPressed(Keyboard.KeyCode.F1);
        keyboard.onKeyPressed(Keyboard.KeyCode.LEFT);
        keyboard.onKeyPressed(Keyboard.KeyCode.UP);
        keyboard.onKeyPressed(Keyboard.KeyCode.ESC);
    }
}
